package com.dreamoo.controller.user;

import com.dreamoo.common.pojo.dto.UserLoginDTO;
import com.dreamoo.common.result.Result;
import com.dreamoo.common.threadlocal.BaseParameterHolder;
import com.dreamoo.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 山顶洞人郑某
 * @className UserController.java
 * @date 2025 05 08
 */
@RestController
@RequestMapping("/dreamoo/user")
@Slf4j
@Tag(name = "用户控制层")
public class UserController {

    @Autowired
    private UserService userService;
    @Operation(summary = "用户登录")
    @ApiResponse(description = "用户登录")
    @PostMapping("/login")
    public Result<String> login(@RequestBody UserLoginDTO userLoginDTO) {
        log.info("用户登录参数:{}", userLoginDTO);
        String token = userService.login(userLoginDTO);
        log.info("用户登录返回:{}", token);
        return Result.success("登录成功",token);
    }


}
